﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Web截屏控件2演示界面</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="Stylesheet" href="scp/scp.css" />
    <link type="text/css" rel="stylesheet" href="scp/skygqbox.css" />
    <script type="text/javascript" src="up2/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="scp/json2.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="scp/skygqbox.js"></script>
    <script type="text/javascript" src="scp/scp.app.js" charset="utf-8"></script>
    <script type="text/javascript" src="scp/scp.edge.js" charset="utf-8"></script>
    <script type="text/javascript" src="scp/scp.js" charset="utf-8"></script>
    <!--up2-->
    <link type="text/css" rel="Stylesheet" href="up2/up2.css" />
    <script type="text/javascript" src="up2/layer/layer.js" charset="utf-8"></script>
    <script type="text/javascript" src="up2/up2.app.js" charset="utf-8"></script>
    <script type="text/javascript" src="up2/up2.edge.js" charset="utf-8"></script>
    <script type="text/javascript" src="up2/up2.file.js" charset="utf-8"></script>
    <script type="text/javascript" src="up2/up2.js" charset="utf-8"></script>
    <script type="text/javascript" src="fckeditor/fckeditor.js" charset="utf-8"></script>
</head>
<body>
    <p>演示ScreenCapture与fckeditor2x编辑器整合</p>
    <textarea id="MyTextarea" name="MyTextarea">此示例演示截屏控件与FCKEditor2.x编辑器整合的功能。</textarea>
    <div id="scpPanel"></div>
    <div id="up2Panel" style="display:none"></div>
    <script type="text/javascript" language="javascript">
        //根路径：http://localhost/api/scp/
        var pos = window.location.href.indexOf("fck2.html");
        var api = [
            window.location.href.substr(0, pos),
            "asp/upload.asp"
        ].join("");
        var api2 = [
            window.location.href.substr(0, pos),
            "upload2.aspx"
        ].join("");
        var editor = null;
        var scpMgr = ScreenCapture.getInstance({
            config: {
                PostUrl: api,
                FileFieldName: "file"
            },
            event: {
                hotKey: function () {
                    setTimeout(function () {
                        scpMgr.Capture2();
                    }, 100);
                },
                postComplete: function (url) {
                    var img = '<img src="' + url + "?t=" + new Date().getTime() + '"/>';
                    editor.InsertHtml(img);
                }
            },
            ui: { render: "scpPanel" }
        });
        var up2 = Uploader2.getInstance({
            config: {
                PostUrl: api2,
                FileFieldName: "file"
            },
            event: {
                post_complete: function (url) {
                    var img = '<img src="' + url + "?t=" + new Date().getTime() + '"/>';
                    editor.InsertHtml(img);
                },
                queue_complete: function (url) {
                },
                add_file: function () { }
            },
            ui: { render: "up2Panel" }
        });

        var oFCKeditor = new FCKeditor('MyTextarea');
        oFCKeditor.BasePath = "fckeditor/";
        oFCKeditor.ToolbarSet = 'Basic';
        oFCKeditor.Height = "200";
        oFCKeditor.ReplaceTextarea();

        function FCKeditor_OnComplete(editorInstance) { editor = editorInstance; }
    </script>
</body>
</html>